package com.platform.usercenter.service.impl;

import java.util.List;
import com.platform.common.core.utils.DateUtils;
import com.platform.usercenter.domain.dto.SysOrganizationPermissionDTO;
import com.platform.usercenter.domain.vo.SysOrganizationPermissionQuery;
import org.springframework.stereotype.Service;
import com.platform.usercenter.mapper.SysOrganizationPermissionMapper;
import com.platform.usercenter.domain.SysOrganizationPermission;
import com.platform.usercenter.service.ISysOrganizationPermissionService;

import javax.annotation.Resource;

/**
 * 组织数据权限关系Service业务层处理
 *
 * @author platform
 * @date 2024-10-28
 */
@Service
public class SysOrganizationPermissionServiceImpl implements ISysOrganizationPermissionService
{
    @Resource
    private SysOrganizationPermissionMapper sysOrganizationPermissionMapper;

    /**
     * 查询组织数据权限关系
     *
     * @param id 组织数据权限关系主键
     * @return 组织数据权限关系
     */
    @Override
    public SysOrganizationPermission selectSysOrganizationPermissionById(Long id)
    {
        return sysOrganizationPermissionMapper.selectSysOrganizationPermissionById(id);
    }

    @Override
    public List<SysOrganizationPermission> selectSysOrganizationPermissionListByApp(Long orgId) {
        return sysOrganizationPermissionMapper.selectSysOrganizationPermissionListByApp(orgId);
    }

    /**
     * 查询组织数据权限关系列表
     *
     * @param sysOrganizationPermission 组织数据权限关系
     * @return 组织数据权限关系
     */
    @Override
    public List<SysOrganizationPermission> selectSysOrganizationPermissionList(SysOrganizationPermission sysOrganizationPermission)
    {
        return sysOrganizationPermissionMapper.selectSysOrganizationPermissionList(sysOrganizationPermission);
    }

    @Override
    public List<SysOrganizationPermissionDTO> selectSysOrganizationPermissionDTOList(SysOrganizationPermissionQuery sysOrganizationPermission) {
        return sysOrganizationPermissionMapper.selectSysOrganizationPermissionDTOList(sysOrganizationPermission);
    }

    /**
     * 新增组织数据权限关系
     *
     * @param sysOrganizationPermission 组织数据权限关系
     * @return 结果
     */
    @Override
    public int insertSysOrganizationPermission(SysOrganizationPermission sysOrganizationPermission)
    {
        sysOrganizationPermission.setCreateTime(DateUtils.getNowDate());
        return sysOrganizationPermissionMapper.insertSysOrganizationPermission(sysOrganizationPermission);
    }

    /**
     * 修改组织数据权限关系
     *
     * @param sysOrganizationPermission 组织数据权限关系
     * @return 结果
     */
    @Override
    public int updateSysOrganizationPermission(SysOrganizationPermission sysOrganizationPermission)
    {
        sysOrganizationPermission.setUpdateTime(DateUtils.getNowDate());
        return sysOrganizationPermissionMapper.updateSysOrganizationPermission(sysOrganizationPermission);
    }

    /**
     * 批量删除组织数据权限关系
     *
     * @param ids 需要删除的组织数据权限关系主键
     * @return 结果
     */
    @Override
    public int deleteSysOrganizationPermissionByIds(Long[] ids)
    {
        return sysOrganizationPermissionMapper.deleteSysOrganizationPermissionByIds(ids);
    }

    /**
     * 删除组织数据权限关系信息
     *
     * @param id 组织数据权限关系主键
     * @return 结果
     */
    @Override
    public int deleteSysOrganizationPermissionById(Long id)
    {
        return sysOrganizationPermissionMapper.deleteSysOrganizationPermissionById(id);
    }
}
